package com.lichenggod.consumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;

@RestController
public class HelloConsumer {
    @Autowired
    RestTemplate restTemplate ;
    @GetMapping("/hello")
    public  String helloTest(HttpServletRequest request){
        request.getParameterMap().forEach((k,v)-> System.out.println("param "+k+" is :"+ Arrays.toString(v)));

        return restTemplate.getForEntity("http://service-hello/hello",String.class,request.getParameterMap()).getBody();
    }
}
